/*
 *  DataStructures.h
 *  c_Render
 *
 *  Created by liao peterson on 11/8/09.
 *  Copyright 2009 uestc. All rights reserved.
 *
 */
#ifndef STRUCTURES_H__
#define STRUCTURES_H__
#include"Macros.h"

template<class T>
class Node{
public:
	T*data;
	Node<T>*prev;
	Node<T>*next;

	Node();
	Node(Node<T>*Nprev,Node<T>*Nnext,T*Ndata);
	~Node();
};

template<class T>
class List{
public:
	Node<T>*head;
	Node<T>*tail;
	Node<T>*current;
	GLint count;
	GLint current_pos;

	List();
	~List();
	
	void Append(T*addOn);
	void Append(Node<T>*addOn);
	
	// Dismiss func, pass -1 for deleting current node
	// Jump to next node after dismisssing
	void Dismiss();
	void Dismiss(GLint);
	
	void SetCurrent(GLint index);
	void IncCurrent(){if(current&&current->next)current=current->next;}
	T*	 CurrentData(){if(current)
						   return current->data;
					   else
						   return NULL;}
};


#endif